<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<body>

<div class="x-nav" style="height: 43px">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
          </span>
    <i class="layui-icon layui-icon-refresh" style="line-height:35px"></i></a>
</div>
<div id="div1">
    <TABLE class="layui-table lay-even  lay-skin='line' lay-size='lg' " style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0 width="100%"
           bgColor=#FFFAE3 borderColorLight=#FFFAE3 border=0>
        <TBODY>
        <TR>
            <TD>
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                    <form id="form1">
                        <TBODY>
                        <TR bgColor=#FFFAE3>
                            <TD align=middle width="100%" bgColor=#FFFAE3 colSpan=20 height=22>
                                <H2>
                                    <b color=#0070c0>添加供应商</b>
                                </H2>
                            </TD>
                        </TR>

                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">供应商名称</TD>
                            <TD name="supplierNum">
                                <input class="layui-input" name="stockName" id="company" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">税    号</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="dutyParagraph" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                        </TR>
                        <TR bgColor=#FFFAE3 >
                            <TD class=t1 noWrap width="20%">供应商简称</TD>
                            <TD name="certificate" >
                                <input class="layui-input" name="abbreviation" id="abbreviation" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">法人代表</TD>
                            <td >
                                <input class="layui-input" name="stockName" id="corporation" autocomplete="off" style="background-color: #FFFAE3">
                            </td>

                        <TR bgColor=#FFFAE3>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">供应商证书编号</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="certificate" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">地    址</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="address" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">邮    编</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="zip" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">注册资金</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="regFund" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">联 系 人</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="contact" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">电    话</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="phone" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">传    真</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="fax" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">电子邮箱</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="email" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="18%">开户银行</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="depositBank" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="18%">公司性质</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="kind" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                    </form>
                    </TBODY></TABLE></TD></TR></TBODY></TABLE>
    <button style="margin-left: 515px" class="layui-btn" data-type="reload" onclick="BaoCun()">保存/填写注册信息</button>
    <button style="margin-left: 15px" class="layui-btn" data-type="reload" onclick="QC()">清除</button>
</div>
<div id="div2">
    <TABLE class="layui-table lay-even  lay-skin='line' lay-size='lg' " style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0 width="100%"
           bgColor=#FFFAE3 borderColorLight=#FFFAE3 border=0>
        <TBODY>
        <TR>
            <TD>
                <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 style="background-color: #FFFAE3">
                    <form id="form2">
                        <TBODY style="background-color: #FFFAE3">
                        <TR bgColor=#FFFAE3 style="background-color: #FFFAE3">
                            <TD align=middle width="100%" bgColor=#ffffff colSpan=20 height=22 style="background-color: #FFFAE3">
                                <H2>
                                    <b color=#0070c0>供应商会员注册</b>
                                </H2>
                            </TD>
                        </TR>

                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="20%">登 录 名</TD>
                            <TD name="supplierNum">
                                <input class="layui-input" name="stockName" id="loginId" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                        </TR>
                        <TR bgColor=#FFFAE3 >
                            <TD class=t1 noWrap width="18%">登陆密码</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="password" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="20%">确认密码</TD>
                            <TD name="certificate" >
                                <input class="layui-input" name="abbreviation" id="password1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="18%">用户姓名</TD>
                            <td >
                                <input class="layui-input" name="stockName" id="empName" autocomplete="off" style="background-color: #FFFAE3">
                            </td>
                            <TD class=t1 noWrap width="20%">性    别</TD>
                            <TD >
                                <select id="sex" style="background-color: #FFFAE3">
                                    <option value="男">男</option>
                                    <option value="女">女</option>
                                </select>
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="18%">联系电话</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="phone1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="20%">传    真</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="fax1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <TR bgColor=#FFFAE3>
                            <TD class=t1 noWrap width="18%">电子邮箱</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="email1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                            <TD class=t1 noWrap width="20%">邮    编</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="zip1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD></TR>
                        <tr bgcolor=#FFFAE3>
                            <TD class=t1 noWrap width="18%">联系地址</TD>
                            <TD >
                                <input class="layui-input" name="stockName" id="address1" autocomplete="off" style="background-color: #FFFAE3">
                            </TD>
                        </tr>
                    </form>
                    </TBODY></TABLE></TD></TR></TBODY></TABLE>
    <button style="margin-left: 545px" class="layui-btn" data-type="reload" onclick="BaoCun1()">保存</button>
    <button style="margin-left: 15px" class="layui-btn" data-type="reload" onclick="QC1()">清空</button>
</div>
</body>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
    function BaoCun1(){
        var loginId=$("#loginId").val();
        var password=$("#password").val();
        var password1=$("#password1").val();
        var empName=$("#empName").val();
        var sex=$("#sex").val();
        var phone1=$("#phone1").val();
        var fax1=$("#fax1").val();
        var email1=$("#email1").val();
        var zip1=$("#zip1").val();
        var address1=$("#address1").val();
        if(password!==password1){
            layer.alert("两次密码不一致!")
        }else if(loginId==null||password==null||empName==null) {
            layer.alert("未填写!")
        }else{
            alert("成功！")
            $.ajax({
                url: "/supplier/User",
                data: {
                    "loginId": loginId,
                    "password": password,
                    "empName": empName,
                    "sex": sex,
                    "phone": phone1,
                    "fax": fax1,
                    "email": email1,
                    "zip": zip1,
                    "address": address1
                },
                type: "GET",
                success: function (result) {
                }
            });
        }
    }
    $(function(){
        $("#div1").show();
        $("#div2").hide();
    });
    function QC(){
        location.reload();
    }
    function QC1(){
    }
    function BaoCun(){
        var company=$("#company").val();
        var dutyParagraph=$("#dutyParagraph").val();
        var abbreviation=$("#abbreviation").val();
        var corporation=$("#corporation").val();
        var certificate=$("#certificate").val();
        var address=$("#address").val();
        var zip=$("#zip").val();
        var regFund=$("#regFund").val();
        var contact=$("#contact").val();
        var phone=$("#phone").val();
        var fax=$("#fax").val();
        var email=$("#email").val();
        var kind=$("#kind").val();
        var depositBank=$("#depositBank").val();

        $.ajax({
            url: "/supplier/Insert",
            data: {
                "company": company,
                "dutyParagraph": dutyParagraph,
                "abbreviation": abbreviation,
                "corporation": corporation,
                "certificate": certificate,
                "address": address,
                "zip": zip,
                "regFund": regFund,
                "contact": contact,
                "phone": phone,
                "fax": fax,
                "email": email,
                "kind": kind,
                "depositBank": depositBank,
            },
            type: "GET",
            success: function (result) {
                $("#div2").show();
                $("#div1").hide();
            }
        });
    }
</script>
</html>